package com.ruitu.health_2.ui.activity;

import android.content.Context;
import android.os.Bundle;
import android.view.View;

import com.github.jdsjlzx.recyclerview.LRecyclerView;
import com.ruitu.arad.base.base_list.BaseRefreshActivity;
import com.ruitu.arad.base.base_list.ListBaseAdapter;
import com.ruitu.arad.base.base_list.SuperViewHolder;
import com.ruitu.arad.support.widget.progress.ProgressLayout;
import com.ruitu.health_2.R;
import com.ruitu.router_module.bean.user.User;

import java.util.ArrayList;
import java.util.List;

import androidx.recyclerview.widget.RecyclerView;

// 聊天列表页面
public class ChatListActivity extends BaseRefreshActivity {

    private ChatListAdapter adapter;//
    private List<User> userList = new ArrayList<>();// 聊天用户列表

    @Override
    protected int getLayoutRes() {
        return R.layout.activity_chat_list;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setHeadTitle("会话列表");

        for (int i = 0; i < 20; i++) {
            User user = new User();
            userList.add(user);
        }
        adapter.setDataList(userList);
    }

    @Override
    protected void onItemClick(View v, int position) {
        startActivity(ChatActivity.class);
    }

    @Override
    protected RecyclerView.Adapter initAdapter() {
        adapter = new ChatListAdapter(this);
        return adapter;
    }

    @Override
    protected LRecyclerView findRecyclerView() {
        return findViewById(R.id.lrcv_list);
    }

    @Override
    protected void reqFirst() {

    }

    @Override
    protected void reqMore() {

    }

    private static class ChatListAdapter extends ListBaseAdapter<User> {

        public ChatListAdapter(Context context) {
            super(context);
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_chat_list;
        }

        @Override
        public void onBindItemHolder(SuperViewHolder holder, int position) {

        }
    }

    @Override
    protected ProgressLayout findProgressLayout() {
        return null;
    }
}
